﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NetPE.Dialogs
{
    public partial class EnumDialog : BaseDialog
    {
        public EnumDialog(object obj)
            : base(obj)
        {
            InitializeComponent();
            foreach (string str in Enum.GetNames(obj.GetType()))
            {
                comboBox1.Items.Add(str);
                if (str == Enum.GetName(obj.GetType(), obj))
                    comboBox1.SelectedIndex = comboBox1.Items.Count - 1;
            }
            this.Text = obj.GetType().Name;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Object = Enum.Parse(Object.GetType(), comboBox1.Text);
        }
    }
}
